class LoadingUI extends egret.Sprite{

    private text:egret.TextField;
	private bg:egret.Shape;
	private logo:egret.Bitmap;

	private sp:egret.Sprite;
	private sp2:egret.Sprite;

	public constructor() {
		super();
		this.bg=new egret.Shape();
		this.bg.graphics.beginFill(0x000000,1);
		this.bg.graphics.drawRect(0,0,740,1136);
		this.addChild(this.bg);

		this.logo=new egret.Bitmap(RES.getRes("LOGO_png"));
		this.logo.anchorOffsetX=this.logo.width/2;
		this.logo.anchorOffsetY=this.logo.height/2;
		this.logo.x=740/2;
		this.logo.y=1136/2-100;
		this.addChild(this.logo);
		this.logo.alpha=0;
		egret.Tween.get(this.logo).to({alpha:1},700,egret.Ease.cubicIn);



		// this.logo=new egret.Bitmap(RES.getRes("bb_jpg"));
		// this.addChild(this.logo);

		this.sp=new egret.Sprite();
        this.sp.graphics.beginFill(0xFFFFFF,1);
        this.sp.graphics.drawRect(0,0,350,4);
        this.sp.anchorOffsetY=this.sp.height/2;
        this.sp.x=(740-this.sp.width)/2;
        this.sp.y=1136/2+0;
        this.sp.alpha=0;
        egret.Tween.get(this.sp).to({alpha:1},700,egret.Ease.cubicIn);

        this.sp2=new egret.Sprite();
        this.sp2.graphics.beginFill(0xff6600,1);
        this.sp2.graphics.drawRect(0,0,350,4);
        this.sp2.anchorOffsetX=0;
        this.sp2.anchorOffsetY=this.sp2.height/2;
        this.sp2.x=(740-this.sp2.width)/2;
        this.sp2.y=1136/2+0;
        this.sp2.scaleX=0;
        this.sp2.alpha=0;
        egret.Tween.get(this.sp2).to({alpha:1},700,egret.Ease.cubicIn);

        this.addChild(this.sp);
        this.addChild(this.sp2);


		// this.text=new egret.TextField();
		// this.text.text="100000";
		// this.text.width=500;
		// this.text.y=300;
		// this.text.size=70;

		// this.addChild(this.text);

	}
	public SetProgress(currentPecent,totalPecent){
		this.sp2.scaleX=currentPecent/totalPecent;
		var This=this;
		if(currentPecent/totalPecent==1){
			MusicOnOff(true);
			egret.Tween.removeTweens(this.logo);
			egret.Tween.removeTweens(this.sp);
			egret.Tween.removeTweens(this.sp2);

   		

            egret.Tween.get(this.logo).to({alpha:0,y:1136*0.4-200},1000,egret.Ease.cubicInOut);
            egret.Tween.get(this.sp).to({alpha:0,y:1136/2+433},1000,egret.Ease.cubicInOut);
            egret.Tween.get(this.sp2).to({alpha:0,y:1136/2+433},1000,egret.Ease.cubicInOut);

		}



		// this.text.text=currentPecent+"/"+totalPecent;
	}
}
declare function MusicOnOff(bl)